package com.ftg.examsys.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * 完成对redis操作类
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/9/28 上午9:09
 */
@Service
public class RedisUtilService {

    //spring 给你提供了大量模板

    @Autowired
    StringRedisTemplate stringRedisTemplate;

    public void setVal(String key, String value) {
        stringRedisTemplate.opsForValue().set(key, value);
    }

    public String getVal(String key) {
        return stringRedisTemplate.opsForValue().get(key);
    }

}
